﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BigEnemy : MonoBehaviour {
	public int blood = 10;
	public float test;
	public GameObject ex;
	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
		transform.Translate (Vector3.down * Time.deltaTime * 1, Space.World);
		transform.Rotate (Vector3.forward * Time.deltaTime * 30, Space.Self);
	}
	void OnTriggerEnter (Collider other)
	{
		if (other.tag == "flight") {
			Destroy (gameObject);
			GameObject.FindGameObjectWithTag ("flight").GetComponent<PlayerMove> ().Planyblood -=4;
			Instantiate (ex, transform.position, Quaternion.identity);
		}
		if (other.tag == "bullet") {
			blood--;
			if (blood <= 0) {
				Destroy (gameObject);
				Instantiate (ex, transform.position, Quaternion.identity);

			}
			Destroy (gameObject);
		}

	}
}
